﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SPPatchServiceUI
{
    /// <summary>
    /// </summary>
    /// <remarks>
    /// Not sure this will actually end up being used... thought it would be necessary for some of the API calls, based on the website's datasets,
    /// but based on the API usage, doesn't appear to be necessary.
    /// 
    ///   Reference materials:
    ///     - https://msdn.microsoft.com/en-us/library/office/ff721969.aspx (How To: Detect the Installed SKU of SharePoint 2010)
    ///     - https://msdn.microsoft.com/en-us/library/office/jj659075.aspx (How to: Detect the installed SKU of SharePoint 2013)
    /// </remarks>
    public static class SPProduct
    {
        private const String SharePointProductsRegistryPath = @"SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\InstalledProducts\";

        public class Product_Name_SvcProd
        {
            public string ProductName { get; set; }
            public PatchServiceAPI.Products PatchServiceProduct { get; set; }

            public Product_Name_SvcProd(PatchServiceAPI.Products SvcProd, string Name)
            {
                this.ProductName = Name;
                this.PatchServiceProduct = SvcProd;
            }
        }
        private readonly static Dictionary<Guid, Product_Name_SvcProd> _productSKUs = new Dictionary<Guid, Product_Name_SvcProd>()
        {
            { new Guid("BEED1F75-C398-4447-AEF1-E66E1F0DF91E"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPF2010 ,"SharePoint Foundation 2010") },
            { new Guid("1328E89E-7EC8-4F7E-809E-7E945796E511"), new Product_Name_SvcProd(PatchServiceAPI.Products.SSE2010 ,"Search Server Express 2010") },
            { new Guid("B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPS2010 ,"SharePoint Server 2010 Standard Trial") },
            { new Guid("3FDFBCC8-B3E4-4482-91FA-122C6432805C"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPS2010 ,"SharePoint Server 2010 Standard") },
            { new Guid("88BED06D-8C6B-4E62-AB01-546D6005FE97"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPS2010 ,"SharePoint Server 2010 Enterprise Trial") },
            { new Guid("D5595F62-449B-4061-B0B2-0CBAD410BB51"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPS2010 ,"SharePoint Server 2010 Enterprise") },
            { new Guid("BC4C1C97-9013-4033-A0DD-9DC9E6D6C887"), new Product_Name_SvcProd(PatchServiceAPI.Products.SS2010 ,"Search Server 2010 Trial") },
            { new Guid("08460AA2-A176-442C-BDCA-26928704D80B"), new Product_Name_SvcProd(PatchServiceAPI.Products.SS2010 ,"Search Server 2010") },
            { new Guid("84902853-59F6-4B20-BC7C-DE4F419FEFAD"), new Product_Name_SvcProd(PatchServiceAPI.Products.PS2010 ,"Project Server 2010 Trial") },
            { new Guid("ED21638F-97FF-4A65-AD9B-6889B93065E2"), new Product_Name_SvcProd(PatchServiceAPI.Products.PS2010 ,"Project Server 2010") },
            { new Guid("926E4E17-087B-47D1-8BD7-91A394BC6196"), new Product_Name_SvcProd(PatchServiceAPI.Products.OWA2010 ,"Office Web Companions 2010") },
            
            { new Guid("9FF54EBC-8C12-47D7-854F-3865D4BE8118"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPF2013 ,"SharePoint Foundation 2013") },
            { new Guid("C5D855EE-F32B-4A1C-97A8-F0A28CE02F9C"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPS2013 ,"SharePoint Server 2013") },
            { new Guid("CBF97833-C73A-4BAF-9ED3-D47B3CFF51BE"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPS2013 ,"SharePoint Server 2013 Preview") },
            { new Guid("B7D84C2B-0754-49E4-B7BE-7EE321DCE0A9"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPS2013 ,"SharePoint Server 2013 Enterprise") },
            { new Guid("298A586A-E3C1-42F0-AFE0-4BCFDC2E7CD0"), new Product_Name_SvcProd(PatchServiceAPI.Products.SPS2013 ,"SharePoint Server 2013 Enterprise Preview") },
            { new Guid("35466B1A-B17B-4DFB-A703-F74E2A1F5F5E"), new Product_Name_SvcProd(PatchServiceAPI.Products.PS2013 ,"Project Server 2013") },
            { new Guid("BC7BAF08-4D97-462C-8411-341052402E71"), new Product_Name_SvcProd(PatchServiceAPI.Products.PS2013 ,"Project Server 2013 Preview") },
            { new Guid("D6B57A0D-AE69-4A3E-B031-1F993EE52EDC"), new Product_Name_SvcProd(PatchServiceAPI.Products.OWA2013 ,"Microsoft Office Online") },

            //{ new Guid("BEED1F75-C398-4447-AEF1-E66E1F0DF91E"), "SharePoint Foundation 2010" },
            //{ new Guid("BEED1F75-C398-4447-AEF1-E66E1F0DF91E"), "SharePoint Foundation 2010" },
            //{ new Guid("BEED1F75-C398-4447-AEF1-E66E1F0DF91E"), "SharePoint Foundation 2010" },
            //{ new Guid("BEED1F75-C398-4447-AEF1-E66E1F0DF91E"), "SharePoint Foundation 2010" },
        };
        public static Dictionary<Guid, Product_Name_SvcProd> ProductSKUs { get { return _productSKUs; } }

    } // class
} // namespace